/**
 * Copyright (C) 2007 Mustafa K. Isik - isik@acm.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

package com.paxcodi.rmi.fibonacci.server;

import java.net.*;
import java.rmi.*;

public class FibonacciServer {
    
    /**
     * Starts the Fibonacci RMI Server.
     * Performs a <code>Naming.rebind()</code> on a <code>UnicastRemoteObject</code>.
     * Therefore a nondaemon thread is implicitly spawned that keeps the server listening.
     * 
     * @param args default commandline parameter array - unused
     */
    public static void main(String[] args) {
	
	try {
	    
	    FibonacciImplementation f = new FibonacciImplementation();
	    Naming.rebind("fibonacci", f); //bind the name "fibonacci" to the object f in the local registry
	    
	} catch (RemoteException ex) {
	  
	    System.err.println("Exception in FibonacciImplementation.main " + ex);
	    
	} catch (MalformedURLException ex) {
	    
	    System.err.println("Malformed URL Exception " + ex);
	    
	}
    }

}
